package com.sun.hunk.struts.form;

import com.sun.hunk.hibernate.domain.Item;
import com.sun.hunk.hibernate.domain.Category;
import com.sun.hunk.hibernate.domain.User;
import com.sun.hunk.hibernate.domain.impl.DomainFactory;
import com.sun.hunk.struts.HunkActionForm;

/**
 *
 * @author sunil
 */
public class ItemForm extends HunkActionForm {

    private Item item;
    private Category category;
    private User user;

    public ItemForm() {
        item = DomainFactory.getItem();
        category = DomainFactory.getCategory();
        user = DomainFactory.getUser();
    }

    public Long getId() {
        return item.getId();
    }

    public void setId(Long id) {
        if(id != null && id > 0){
            item.setId(id);
        }
    }

    public Integer getQuantity() {
        return item.getQuantity();
    }

    public void setQuantity(Integer q) {
        item.setQuantity(q);
    }

    public String getCode() {
        return item.getCode();
    }

    public void setCode(String code) {
        item.setCode(code);
    }
    public String getDescription() {
        return item.getDescription();
    }

    public void setDescription(String desc) {
        item.setDescription(desc);
    }

    public String getCategoryDescription() {
        return category.getDescription();
    }

    public void setCategoryDescription(String desc) {
        category.setDescription(desc);
    }

    public Long getCategoryId() {
        return category.getId();
    }

    public void setCategoryId(Long id) {       
        if(id != null && id > 0){
            category.setId(id);
        }
    }

    public void setLoginName(String loginName) {
        user.setLoginName(loginName);
    }

    public String getLoginName() {
        return user.getLoginName();
    }
    
    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public Item getItem() {
        return item;
    }

    public void setItem(Item item) {
        this.item = item;
    }
    
    public Category getCategory() {
        return category;
    }

    public void setCategory(Category category) {
        this.category = category;
    }

}
